<template>
  <!--单行检查dialog-->
  <el-dialog
    title="检查结果"
    width="600px"
    :visible.sync="dialogVisible"
    v-dialogDrag
    :close-on-click-modal="false"
    customClass="mes_dialog">
    <div class="table_container">
      <el-table
        :data="tableData"
        v-loading="isLoading"
        border
        stripe
        tooltip-effect="dark"
        class="table_dialog">
        <el-table-column
          label="序号"
          type="index"
          width="60"
          align="center"
        ></el-table-column>
        <el-table-column
          label="检查项"
          prop="name"
          align="left"
        ></el-table-column>
        <el-table-column
          label="结果"
          :resizable="false"
          prop="value"
          width="60"
          align="center">
          <template slot-scope="scope">
            <i class="iconfont icon-btn_Save" v-if="scope.row.value === 'ID_BT_True'"></i>
            <i class="iconfont icon-tab_close_n" v-else></i>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <span slot="footer" class="mes_btn">
      <el-button @click="dialogVisible = false">关闭</el-button>
    </span>
  </el-dialog>
</template>

<script>
/**
 * @author liubaohui
 */
export default {
  name: 'CheckRowDialog',
  data() {
    return {
      dialogVisible: false,
      isLoading: false
    }
  },
  computed: {
    tableData() {
      return this.$store.state.technicalConfirm.checkData.list || []
    }
  },
  methods: {
    /**
     * 显示弹窗并接收传值
     */
    openDialog(id) {
      this.dialogVisible = true
      this.init(id)
    },
    init(id) {
      this.isLoading = true
      let commitObj = {
        method: 'get',
        url: 'a/workorder/workorder/conditionCheck',
        params: {
          id: id
        },
        module: 'technicalConfirm',
        state: 'checkData'
      }
      this.$store.dispatch('saveData', commitObj).finally(() => {
        this.isLoading = false
      })
    },
  }
}
</script>

<style lang="less" scoped>
  .icon-btn_Save {
    color: @btnAddBgC;
  }

  .icon-tab_close_n {
    color: @btnDeleteBgC;
  }
</style>
